<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<script type="text/javascript">
	$(document).ready(function(){			
		$("#deleteBtn").click(function(){						
			if(!confirm("파일을 삭제하시겠습니까?")){
				return;
			}
			alert("${requestScope.dvo.newfilename}");
			 $.ajax({
					type:"POST",
					url:"${initParam.root}mypage/auth_deleteUploadFile.do",			
					data:"filename=${requestScope.dvo.newfilename}",
					success:function(jsonData){
						alert(jsonData.info);
						$("#uploadView").html("<input type='file' name='uploadFile'>");
					}// success
				  });//ajax 			 	 			
	  		 });//click
	  		 $("#listBtn").click(function(){
	  			location.href="${initParam.root}mypage/auth_diaryList.do";
	  		 });
	});//ready
	</script>
</head>
<h3>다이어리 수정</h3>
<form action="${initParam.root}mypage/auth_updateDiary.do" method="post" enctype="multipart/form-data">
<input type="hidden" name="no" value="${requestScope.dvo.no}">
<input type="hidden" name="page" value="${requestScope.dvo.page}">
<span id="uploadView">
	<c:choose>
		<c:when test="${requestScope.dvo.orgfilename!=null }">
			${requestScope.dvo.orgfilename}
			<input type="button" id="deleteBtn" value="삭제">
		</c:when>
		<c:otherwise>
			<input type="file" name="uploadFile">
		</c:otherwise>
	</c:choose>
</span>
<textarea cols="80" rows="15" id="content" name="content" placeholder="내용">
${requestScope.dvo.content}</textarea>
<br>
<input type="submit" value="수정">
<input type="button" value="목록" id="listBtn">
</form>